package server;

import java.io.Serializable;

public class Log  implements Serializable {
	private static final long serialVersionUID = 8108957583000878929L;
	public Log() {
		
	}

	//TODO is there an inconsistency here?
	
	public Log(long time, directOpt direct, String sourceIP, String destIp, int sourcePort, int destPort, String protocol, actionOpt action) {
		type = typeOpt.IP;
		this.time = time;
		this.direct = direct;
		this.sourceIp = sourceIP;
		this.destIp = destIp;
		this.sourcePort = sourcePort;
		this.destPort = destPort;
		this.protocol = protocol;
		this.action = action;
	}
	
	public Log(long time, directOpt direct, String sourceIP, String destIp, int sourcePort, int destPort, int rulePort, String ruleProtocol, actionOpt action) {
		type = typeOpt.CONTEXT;
		this.time = time;
		this.direct = direct;
		this.sourceIp = sourceIP;
		this.destIp = destIp;
		this.sourcePort = sourcePort;
		this.destPort = destPort;
		this.action = action;
		this.rulePort = rulePort;
		this.ruleProtocol = ruleProtocol;
	}
	
	public static enum typeOpt {IP, CONTEXT};
	public static enum actionOpt {ACCEPT, DENY};
	public static enum directOpt {IN, OUT};
	public typeOpt type;
	public long time;
	public directOpt direct;
	public String sourceIp;
	public String destIp;
	public int sourcePort;
	public int destPort;
	public String protocol;
	public int rulePort;
	public String ruleProtocol;
	public actionOpt action;
}

